//
//  InfoPhoto.m
//  时尚男士
//
//  Created by dlios on 15-6-10.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "InfoPhoto.h"

@implementation InfoPhoto

//- (instancetype)initWithDictionary:(NSDictionary *)dic
//{
//    self = [super init];
//    if (self) {
//        NSArray *arr = [dic objectForKey:@"T1348650593803"];
//        for (NSDictionary *tempDic in arr) {
//            NSString *key = [tempDic objectForKey:@"@rel"];
//            NSString *value = [tempDic objectForKey:@"@href"];
//            [self setValue:value forKey:key];
//        }
//    }
//    return self;
//}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"imgsrc"]) {
        self.image = value;
    }
    if ([key isEqualToString:@"imgscrxt"]) {
        self.image = [[value objectAtIndex:1]objectForKey:@"imgsrc"];
        self.image = [[value objectAtIndex:0] objectForKey:@"imgsrc"];
    }
}

+ (NSMutableArray *)photoArrWithDicArr:(NSArray *)dicArr
{
    NSMutableArray *arr = [NSMutableArray array];
    
    //遍历数组中的所有的字典
    for (NSDictionary *dic in dicArr) {
        InfoPhoto *photo = [[InfoPhoto alloc] init];
        [photo setValuesForKeysWithDictionary:dic];
        [arr addObject:photo];
        [photo release];
    }
    return arr;
}

- (void)dealloc
{
    [_digest release];
    [_image release];
    [super dealloc];
}

@end
